package cn.kgc.service.impl;

import cn.kgc.entity.ChatMsg;
import cn.kgc.mapper.ChatMsgMapper;
import cn.kgc.service.ChatMsgService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;


/**
 * @author YC
 */
@Slf4j
@Service("chatMsgService")
public class ChatMsgServiceImpl extends ServiceImpl<ChatMsgMapper, ChatMsg> implements ChatMsgService {

    @Override
    public boolean hasRead(String msgId) {
        ChatMsg chatMsg = baseMapper.selectById(msgId);
        if (chatMsg != null) {
            chatMsg.setIsRead(Short.valueOf("1"));
            return baseMapper.updateById(chatMsg) > 0;
        }
        return false;
    }

}
